//
//  UIEngine.m
//  PLTest
//
//  Created by beeway10 on 14-3-5.
//  Copyright (c) 2014年 beeway10. All rights reserved.
//

#import "UIEngine.h"
#import "AppDelegate.h"
#import "BrandShowroom.h"
#import "openVIdeoPage.h"
@interface UIEngine ()

@end

@implementation UIEngine
@synthesize NavCon;

+ (UIEngine *)sharedInstance{
    static dispatch_once_t  onceToken;
    static UIEngine * sSharedInstance;
    dispatch_once(&onceToken, ^{
        sSharedInstance = [[UIEngine alloc] init];
    });
    return sSharedInstance;
}

-(void) dealloc
{
    NSLog(@"---------  UIEngine dealloc.");
}

#pragma mark - UIEngine (UIEngineRootViewController)

-(UIViewController *) rootViewController{
    openVIdeoPage *controller = [[openVIdeoPage alloc]initWithDefault];
    controller.delegate = self;
    return controller;
}

-(void) setRootViewController:(UIViewController *)rootViewController
{
    UIApplication *app = [UIApplication sharedApplication];
    AppDelegate *delegate = (AppDelegate *)app.delegate;
   self.NavCon=[[UINavigationController alloc]initWithRootViewController:rootViewController];
    delegate.window.rootViewController =NavCon;

}

#pragma mark - UIEngine (OpenVideoControllerDelegate)

-(void)openVideoControllerDidStop
{
    BrandShowroom *controller = [[BrandShowroom alloc]init];
    
    [self setRootViewController:controller];
}

@end
